<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex flex-wrap align-center justify-between benben-position-layout flex couponMy_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center couponMy_fd0_0' @tap.stop="handleJumpDiy" data-type="back"
					data-url="1">
					<text class='fu-iconfont2  couponMy_fd0_0_c0'>&#xe794;</text>
				</view>
				<text class='couponMy_fd0_1'
					style="font-family: Alimama DongFangDaKai, Alimama DongFangDaKai;">我的优惠券</text>
				<view class='flex flex-wrap align-center couponMy_fd0_2'>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout">
				<view>
					<benben-flex-tabs class-name='couponMy_benbenTabsfd1_0' v-model="tabs" ref="benben_tabsfd1_0"
						select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false'
						:open-sticky='true' :top='0' :is-show-content='false' :scrollspy='false'
						:tabs-info.sync="tabsInfofd1_0" @change="getListqsFunc()">

						<scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
							class="benben-tabs" style="width:750rpx" :scroll-x="true"
							:scroll-left.sync="tabsInfofd1_0.moveX" scroll-with-animation="all .3s ease">
							<view class="benben-tabs-content" id="benben_tabsfd1_0-content">
								<view id="benben_tabsfd1_0-title"
									class="benben-tabs-title flex flex align-center justify-around">
									<view
										:class="{ 'checkTitlefd1_0': tabs == '0', 'flex flex-wrap align-center': true }"
										@tap="tabs = '0'" :id="`benben_tabsfd1_0-title-item-${'0'}`">

										<text class='couponMy_titleItemfd1_0_c3_c0'>全部</text>

									</view>
									<view
										:class="{ 'checkTitlefd1_0': tabs == '1', 'flex flex-wrap align-center': true }"
										@tap="tabs = '1'" :id="`benben_tabsfd1_0-title-item-${'1'}`">

										<text class='couponMy_titleItemfd1_0_c3_c0'>未使用</text>

									</view>
									<view
										:class="{ 'checkTitlefd1_0': tabs == '2', 'flex flex-wrap align-center': true }"
										@tap="tabs = '2'" :id="`benben_tabsfd1_0-title-item-${'2'}`">

										<text>已过期</text>

									</view>
								</view>
								<view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
									id="benben_tabsfd1_0-line"
									class="benben-tabs-line flex benben-flex-tabs-line couponMy_linefd1_0"></view>
							</view>
						</scroll-view>

					</benben-flex-tabs>

				</view>

				<view v-for='(item,key0) in dataList' class='flex flex-direction align-stretch couponMy_bodyfd1_0_c3'
					:key='key0'>
					<view class='flex flex-direction flex-wrap align-stretch couponMy_fd1_1_c0'
						:class="{un_valid:in_array(item.status,'2')}">
						<view class='flex  align-center couponMy_fd1_1_c0_c0'>
							<view style="width: 176rpx;margin-right: 24rpx;">
								<view class='flex flex-wrap justify-center align-center' style="align-items: baseline;">
									<text class='couponMy_fd1_1_c0_c0_c0_c0_c1' v-if="isInteger(Number(item.money))">{{Number(item.money)}}</text>
									<text style="font-size: 40rpx;" class='couponMy_fd1_1_c0_c0_c0_c0_c1' v-else>{{Number(item.money)}}</text>
									<text class='couponMy_fd1_1_c0_c0_c0_c0_c0' v-if="isInteger(Number(item.money))">元</text>
									<text style="font-size: 34rpx;" class='couponMy_fd1_1_c0_c0_c0_c0_c0' v-else>元</text>
								</view>
								<view class='flex flex-wrap justify-center align-center couponMy_fd1_1_c0_c0_c0_c1'>
									<text>满</text>
									<text>{{Number(item.min_order_money)}}</text>
									<text>可减</text>
								</view>
							</view>
							<view class='couponMy_fd1_1_c0_c0_c1' style="width: calc(100% - 200rpx);">
								<view class='flex align-center justify-between'>
									<view class='couponMy_fd1_1_c0_c0_c1_c0_c0'>{{item.name}}</view>
									<view class="btn_1" v-if="item.status == 0">{{item.status_txt}}</view>
									<view class="btn_2" v-else>{{item.status_txt}}</view>
								</view>
								<view class=' couponMy_fd1_1_c0_c0_c1_c2'>
									<view class='couponMy_fd1_1_c0_c0_c1_c2_c1'>{{item.content}}</view>
									<view class='couponMy_fd1_1_c0_c0_c1_c2_c1'>
										<text>有效期至：</text>
										<text>{{item.end_time}}</text>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

				<view class='flex flex-wrap align-center'>
					<benben-empty :list-data="dataList">
						<view class='flex flex-direction flex-wrap align-center couponMy_fd1_2_c0'>
							<image class='couponMy_fd1_2_c0_c0' mode="widthFix" :src='STATIC_URL+"178.png"'></image>
						</view>
					</benben-empty>
				</view>
			</view>

			<!---flex布局flex布局结束-->


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				pageLoading: true,
				"tabsInfofd1_0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0
				},
				"tabs": "0",
				"dataList": []
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getListqsFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			isInteger(obj) {
				return obj % 1 === 0
			},
			//优惠券-我的优惠券列表
			async getListFunc() {
				//请求方法
				//数据验证

				let datadataList = await this.$api.post(global.apiUrls.post64198610a95ca, {
					type: this.tabs
				});

				if (datadataList.data.code != 1) {
					this.$message.info(datadataList.data.msg);
					return
				}
				let infodataList = datadataList.data;
				this.dataList = infodataList.data
			},
			//优惠券-我的优惠券列表
			async getListqsFunc() {
				this.pageLoading = true;
				try {
					this.dataList = [];
					const res = await this.$post('6551d332332da', {
						status: this.tabs,
						page: 1,
					});
					this.dataList = res.data || [];
					this.dataList.forEach((v, k) => {
						console.log('length', Number(v.money).length);
					})
				} catch (e) {
					this.$msg((e || {}).msg || "失败")
				}
				this.pageLoading = false;
			}
		}
	};
</script>
<style lang="scss" scoped>
	.btn_1 {
		width: 120rpx;
		height: 48rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		border: 1rpx solid #EF3131;
		color: #EF3131;
		font-size: 24rpx;
		text-align: center;
		line-height: 48rpx;
	}

	.btn_2 {
		width: 120rpx;
		height: 48rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		border: 1rpx solid #BFBFBF;
		color: #999999;
		font-size: 24rpx;
		text-align: center;
		line-height: 48rpx;
	}

	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background-size: 100% auto;
		background-color: #f5f6f8;
	}

	.couponMy_flex_0 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
		background-color: #FFFFFF;
	}

	.couponMy_fd0_2 {
		width: 100rpx;
		height: 88rpx;
	}

	.couponMy_fd0_1 {
		color: #333;
		font-size: 36rpx;
		font-weight: 500;
	}

	.couponMy_fd0_0_c0 {
		font-size: 34rpx;
		color: #333333;
	}

	.couponMy_fd0_0 {
		width: 100rpx;
		height: 88rpx;
		padding: 0rpx 0rpx 0rpx 32rpx;
	}

	.couponMy_fd1_2_c0_c1 {
		padding: 30rpx 0rpx 0rpx 0rpx;
		color: #929292;
	}

	.couponMy_fd1_2_c0_c0 {
		width: 400rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.couponMy_fd1_2_c0 {
		width: 100%;
		padding: 50rpx 0rpx 50rpx 0rpx;
	}

	.couponMy_fd1_1_c1 {
		background: url(https://www.guochaoxiaoju.com/uploads/mini/688.png) no-repeat;
		background-size: 100% 100% !important;
		padding: 30rpx 16rpx 30rpx 30rpx;
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.couponMy_fd1_1_c0_c0_c2_c0 {
		color: #FFFFFF;
		font-size: 26rpx;
		font-weight: 400;
	}

	.couponMy_fd1_1_c0_c0_c1_c2_c1 {
		color: #999999;
		font-weight: 400;
		font-size: 24rpx;
		font-family: Source Han Sans CN, Source Han Sans CN;
		margin-bottom: 16rpx;

		&:last-of-type {
			margin-bottom: 0;
		}
	}

	.couponMy_fd1_1_c0_c0_c1_c2_c0 {
		color: rgba(51, 51, 51, 1);
		font-size: 24rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.couponMy_fd1_1_c0_c0_c1_c2 {
		color: rgba(51, 51, 51, 1);
		margin-top: 8rpx;
	}

	.couponMy_fd1_1_c0_c0_c1_c1_c0 {
		color: #999999;
		font-size: 26rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.couponMy_fd1_1_c0_c0_c1_c1 {
		margin: 30rpx 0rpx 19rpx 0rpx;
		color: rgba(51, 51, 51, 1);
		font-size: 20rpx;
	}

	.couponMy_fd1_1_c0_c0_c1_c0_c0 {
		color: #333333;
		font-weight: 500;
		font-size: 32rpx;
	}

	.couponMy_fd1_1_c0_c0_c1 {}

	.couponMy_fd1_1_c0_c0_c0_c1 {
		color: #fff;
		font-size: 24rpx;
		font-weight: 500;
	}

	.couponMy_fd1_1_c0_c0_c0_c0_c1 {
		color: #fff;
		font-size: 52rpx;
		font-weight: 500;
		// max-width: 100rpx;
		// display: -webkit-box;
		// -webkit-line-clamp: 1; //显示3行文字
		// -webkit-box-orient: vertical;
		// overflow: hidden;
		// text-overflow: ellipsis;
	}

	.couponMy_fd1_1_c0_c0_c0_c0_c0 {
		color: #fff;
		font-size: 42rpx;
		font-weight: 500;
	}

	.couponMy_fd1_1_c0_c0 {
		// padding: 0rpx 0rpx 14rpx 0rpx;
	}

	.couponMy_fd1_1_c0 {
		background: url(https://yongzhixing.niurenjianzhan.com/uploads/mini/722.png) no-repeat;
		background-size: 100% 100% !important;
		padding: 24rpx 32rpx 24rpx 0rpx;
		margin: 24rpx 0rpx 0rpx 0rpx;
		height: 180rpx;

		&.un_valid {
			background-image: url("https://yongzhixing.niurenjianzhan.com/uploads/mini/485.png");
		}
	}

	.couponMy_bodyfd1_0_c3 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.couponMy_titleItemfd1_0_c3_c0 {
		font-size: 32rpx;
	}

	.couponMy_linefd1_0 {
		background: #F35D2A;
		width: 32rpx;
		height: 6rpx;
		top: 80rpx;
		background-size: 100% auto !important;
		border-radius: 3rpx;
	}

	.checkTitlefd1_0 {
		font-weight: 700 !important;
		font-size: 32rpx !important;
		color: #333 !important;
	}

	::v-deep .couponMy_benbenTabsfd1_0 {
		width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		text-align: center;
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
		background: #FFFFFF;
	}
</style>